home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.arch.arithmetic,comp.lang.c,comp.lang.c++
- Path: uu4news.netcom.com!zodiac!szh
- From: szh@zcon.com (Syed Zaeem Hosain)
- Subject: Re: Access carry flag from C
- Message-ID: <1996Feb26.175737.12702@zcon.com>
- Sender: szh@zcon.com (Syed Zaeem Hosain)
- Nntp-Posting-Host: zodiac
- Reply-To: szh@zcon.com
- Organization: Z Consulting Group
- References: <4gqj0d$d6p@airdmhor.gen.nz>
- Date: Mon, 26 Feb 1996 17:57:37 GMT
-
- In article <4gqj0d$d6p@airdmhor.gen.nz>, gumboot@airdmhor.gen.nz (Simon Hosie) writes:
- >Lawrence Kirby:
- >> It certainly can be done portably although not with the efficiency that
- >> a platform-specific solution is likely to give you.
- >
- >> int j, k;
- >
- >> ...
- >
- >> if ((j >= 0) ? (k > INT_MAX-j) : (k < INT_MIN-j))
- > ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
- > Won't they both be evaluated?
-
- No. The conditional expression (j >= 0) determines which one of the
- other expressions is evaluated, and then this result is used for the
- "if" to be evaluated.
-
- Think of it (inside the "if" of course) as:
-
- exp1 ? exp2 : exp3
-
- and then it will be clearer.
-
-
- Z
-
-
- --
- -------------------------------------------------------------------------
- | Syed Zaeem Hosain P. O. Box 610097 (408) 441-7021 |
- | Z Consulting Group San Jose, CA 95161 szh@zcon.com |
- -------------------------------------------------------------------------
-